home *** CD-ROM | disk | FTP | other *** search
/ MIDICraft's MIDINET CD-ROM / MIDICraft's MIDINET CD-ROM.iso / DOSUTILS / MIDISORT.DOC < prev    next >
Text File  |  1995-10-21  |  8KB  |  208 lines

  1.         ******************************
  2.             MIDISORT v1.0
  3.     
  4.          sort tracks of midi binaries 
  5.               by Guenter Nagler 
  6.                 1995 
  7.           (gnagler@ihm.tu-graz.ac.at)
  8.         ******************************
  9.  
  10. [0] FEATURES
  11.     + reads a binary midi file
  12.     + writes a binary midi file
  13.     + shows tracks of a binary file  (title, channel, instrument)
  14.     + user can manually assign order numbers to tracks
  15.     + can sort by channel numbers in increasing order
  16.     + can move comment tracks (empty tracks, tracks without notes)
  17.       behind all note playing tracks 
  18.     + keeps tempo track and format 0 track as first track
  19.  
  20. [1] BACKGROUND
  21. I send midi songs through the Soundblaster player to a music workstation 
  22. and had some problems with some midi files. Some files played only few 
  23. voices even if the midi file contained full orchestral song. 
  24. I found that these midi files contained many tracks that did not play
  25. something but contained text information about the author or advertisement.
  26. My player seems to limit the number of tracks to the first 16 tracks.
  27. That was very bad because many of the tracks were empty and other 
  28. important tracks were not played.
  29. (Critics to Creative Labs: Why didn't you ignore short tracks that only 
  30. contain    text information?)
  31.  
  32. First I used midi2txt and txt2midi converters to manually move 
  33. the comment tracks to the end of the midi file.    
  34. Then I had the idea to implement a simple program that can do that 
  35. and added some other track sorting features.
  36.  
  37. [2] FILES DESCRIPTION
  38.  
  39. MIDISORT.EXE.........sort program
  40. MIDISORT.DOC.........this file, showing usage of MIDISORT.EXE
  41. MIDIIO.HPP...........header file for a c++ midi parser
  42. MIDIIO.CPP...........source code for a c++ midi parser
  43. MTRACK.HPP...........header file for track information gathering
  44. MTRACK.CPP...........source code for track information gathering
  45. MIDISORT.CPP.........c++ source code for modifying midi files
  46. MIDISORT.MAK.........make file for project 
  47. MIDISORT.CFG.........compiler options for make
  48. MIDISORT.PRJ.........compiler project for borland c++ compilers
  49. only MIDISORT.EXE is required to run program
  50.  
  51. [3] COPYRIGHT
  52.  
  53. MIDISORT (c) 1995 was created by Guenter Nagler.
  54.  
  55. MIDISORT is free and may be used as you wish with this one exception:
  56.  
  57.     You may NOT charge any fee or derive any profit for distribution
  58.     of MIDISORT.  Thus, you may NOT sell or bundle MIDISORT with any 
  59.     product in a retail environment (shareware disk distribution, CD-ROM,
  60.     etc.) without permission of the author.
  61.  
  62. You may give MIDISORT to your friends, upload it to a BBS, or ftp it to
  63. another internet site, as long as you don't charge anything for it.
  64.  
  65. [4] DISCLAIMER
  66.  
  67. MIDISORT was designed to handle 100% compatible midi files.
  68. The midi parser was tested with 600 different midi files but I can 
  69. not say if each 100% midi compatible midi file can be correctly converted.
  70. So I give no guarantees of the results, especially with non 100% 
  71. compatible midi files.
  72. If you find a midi file that you think to be 100% compatible midi
  73. that is not correctly converted, please send a sample file to 
  74. gnagler@ihm.tu-graz.ac.at . 
  75.  
  76. Use MIDISORT at your own risk.  Anything you do with MIDISORT is your
  77. responsibility, and not the author's.  Any damage caused to any person,
  78. computer, software, hardware, company, or business by running MIDISORT 
  79. is your responsibility, and the author will not be liable.
  80.  
  81. If you don't understand these terms, or are not sure of something, or
  82. are afraid something bad might come of using MIDISORT, don't  use  it!
  83. You are here forewarned.
  84.  
  85. [5] INSTALLATION
  86.  
  87. [MSDOS]
  88. Simply copy MIDISORT.EXE in a directory that is in your path.
  89. When you start the program without arguments
  90.  
  91. [UNIX]
  92. compile sources with your C++ compiler (e.g. GNU Compiler g++):
  93.  
  94. g++ -o midisort midisort.cpp midiio.cpp mtrack.cpp
  95.  
  96. and run program
  97.  
  98. $ midisort
  99.  
  100. C:\> MIDISORT
  101.  
  102.  
  103. you should get the usage text (see next section)
  104.  
  105. [6] USAGE
  106.  
  107. usage: MIDISORT [-track] [-order # ...] [-channel] [-moveempty] srcfile.mid dstfile.mid
  108.  
  109. The parts in brackets [...] are optional.
  110.  
  111. The program MIDISORT allows following options:
  112. -track  show track information of srcfile.mid (dstfile.mid is not necessary 
  113.     when using this option)                                                           
  114. -order # ...
  115.         set order of tracks manually. This option needs one or more 
  116.         track numbers between 1 and number of tracks (maximum 50)
  117.         e.g. -order 4 3 2 1
  118.      the remaining tracks follow unsorted (if only manually sorting)
  119.  
  120. -channel sort by channel numbers (option -track shows them)
  121.     channels that have no special channel number 
  122.     (MULTICHANNEL or NOCHANNEL) are not sorted (use manually sorting
  123.         or option -moveempty to sort these ones).
  124.  
  125. -moveempty
  126.     moves tracks without special channel numbers to the end 
  127.         (the order of these comment tracks remains as in original file)
  128.  
  129. Warning:
  130.   Do not expect that MIDISORT will produce a copy of the original
  131.   file if sorting is not used! MIDI allows to encode its commands in 
  132.   different ways without changing the semantic of the notes 
  133.   (It is allowed to compress the midi file by ommiting redunant command 
  134.   bytes, but it is no duty).
  135.       
  136. [8] SUGGESTIONS / COMMENTS / BUG REPORTS / QUESTIONS
  137.  
  138.          WWW:    http://hgiicm.tu-graz.ac.at/Cpub
  139.           contains all my dos/unix midi programs
  140.          EMAIL:  gnagler@ihm.tu-graz.ac.at
  141.  
  142. [9] USE
  143.  
  144. example: show tracks of the midi file example.mid
  145.    midisort -track example.mid
  146.  
  147. Track 1 [NOCHANNEL]: An example midi of format 1
  148. Track 2 [NOCHANNEL]: sequenced by Guenter Nagler (Austria) 
  149. Track 3 [NOCHANNEL]: You find free midi programs in WWW page:   
  150. Track 4 [NOCHANNEL]: http://hgiicm.tu-graz.ac.at/Cpub
  151. Track 5 [NOCHANNEL]: mailto:gnagler@ihm.tu-graz.ac.at
  152. Track 6 [1]: Track01 (Marcato)
  153. Track 7 [2]: Track02 (SynChiff)
  154. Track 8 [3]: Track03 (SynthBass1)
  155. Track 9 [4]: Track04 (Bass&Lead)
  156. Track 10 [5]: Track05 (Vibes)
  157. Track 11 [NOCHANNEL]: 
  158. Track 12 [10]: Track09 (Drums)
  159. Track 13 [10]: Track10 (Drums)
  160. Track 14 [10]: Track11 (Drums)
  161. Track 15 [12]: Track12 (Seashore)
  162.  
  163. example: move comment tracks to end of a midi file (symptoms: only few
  164.    of the tracks are played)
  165.  
  166.    midisort -moveempty example.mid sorted.mid
  167.  
  168. The result tracks of sorted.mid will be:
  169. Track 1 [NOCHANNEL]: An example midi of format 1
  170. Track 2 [1]: Track01 (Marcato)
  171. Track 3 [2]: Track02 (SynChiff)
  172. Track 4 [3]: Track03 (SynthBass1)
  173. Track 5 [4]: Track04 (Bass&Lead)
  174. Track 6 [5]: Track05 (Vibes)
  175. Track 7 [10]: Track09 (Drums)
  176. Track 8 [10]: Track10 (Drums)
  177. Track 9 [10]: Track11 (Drums)
  178. Track 10 [12]: Track12 (Seashore)
  179. Track 11 [NOCHANNEL]: sequenced by Guenter Nagler (Austria) 
  180. Track 12 [NOCHANNEL]: You find free midi programs in WWW page:   
  181. Track 13 [NOCHANNEL]: http://hgiicm.tu-graz.ac.at/Cpub
  182. Track 14 [NOCHANNEL]: mailto:gnagler@ihm.tu-graz.ac.at
  183. Track 15 [NOCHANNEL]: 
  184.  
  185. As you see, the first track (tempo track) will never be moved!
  186.  
  187. example: sort example.mid tracks manually in reverse order and 
  188.      move empty tracks to end
  189.  
  190.    midisort -order 15 14 13 12 10 9 8 7 6 -moveempty example.mid sorted.mid
  191.  
  192. Track 1 [NOCHANNEL]: An example midi of format 1
  193. Track 2 [12]: Track12 (Seashore)
  194. Track 3 [10]: Track11 (Drums)
  195. Track 4 [10]: Track10 (Drums)
  196. Track 5 [10]: Track09 (Drums)
  197. Track 6 [5]: Track05 (Vibes)
  198. Track 7 [4]: Track04 (Bass&Lead)
  199. Track 8 [3]: Track03 (SynthBass1)
  200. Track 9 [2]: Track02 (SynChiff)
  201. Track 10 [1]: Track01 (Marcato)
  202. Track 11 [NOCHANNEL]: sequenced by Guenter Nagler (Austria) 
  203. Track 12 [NOCHANNEL]: You find free midi programs in WWW page:   
  204. Track 13 [NOCHANNEL]: http://hgiicm.tu-graz.ac.at/Cpub
  205. Track 14 [NOCHANNEL]: mailto:gnagler@ihm.tu-graz.ac.at
  206. Track 15 [NOCHANNEL]: 
  207.  
  208.